using System;
using System.Collections.Generic;
using System.Text;

namespace ProCodes.Utilities
{
    public class TextIO
    {
        private System.IO.StreamWriter streamWriterObj;
        private System.IO.FileStream fileStreamObj;

        //public string CreateFile(string filePath, string fileName, FileType.CreatedFileType newlyCreatedFileType)
        //{
        //    string newlyCreatedFile = filePath + "\\" + fileName + "." + newlyCreatedFileType;
        //    fileStreamObj = new System.IO.FileStream(newlyCreatedFile, System.IO.FileMode.Create);
        //    fileStreamObj.Close();
        //    return newlyCreatedFile;
        //}

        public void AppendTextToFile(string appendedTextLine, string filePath)
        {
            streamWriterObj = System.IO.File.AppendText(filePath);
            streamWriterObj.WriteLine(appendedTextLine);
            streamWriterObj.Close();
        }

        public void AppendTextToFile(List<string> appendedText, string filePath)
        {
            streamWriterObj = System.IO.File.AppendText(filePath);
            foreach (string strTextLine in appendedText)
                streamWriterObj.WriteLine(strTextLine);
            streamWriterObj.Close();
        }

        public List<string> getReadedLinsFromFile(string filePath)
        {
            List<string> arrReadedLines = new List<string>(System.IO.File.ReadAllLines(filePath));
            return arrReadedLines;
        }

        public string getReadedTextFromFile(string filePath)
        {
            string strReadedText = System.IO.File.ReadAllText(filePath);
            return strReadedText;
        }
    }
}
